<?php
class CSelect
{
	public static $_items;
	
	public static function items($class, $title = 'name')
	{
		//if(!isset(self::$_items))
		self::loadItems($class, $title);
		return self::$_items;
	}

	public static function item($id, $class, $title = 'name')
	{
		//if(!isset(self::$_items))
		self::loadItems($class, $title);
		return isset(self::$_items[$id]) ? self::$_items[$id] : false;
	}

	private static function loadItems($class, $title = 'name', $group=NULL)
	{
		self::$_items=array();
		$clasObject = new $class;
		$models=$clasObject->findAll();
		foreach($models as $model)
			self::$_items[$model->id]= $model->$title;
	}
}
?>